//If user enters only one command line argument than inner try block should throw an Exception.
//If user enters two command line arguments, divide first argument by second argument.
// If second argument is zero than proper exception should be handled.
public class CommandLineException {
    public static void main(String[] args) {
        try {
            if (args.length == 1) {
                throw new Exception("CustomException: Only one argument provided.");
            } else if (args.length == 2) {
                int num1 = Integer.parseInt(args[0]);
                int num2 = Integer.parseInt(args[1]);

                try {
                    if (num2 == 0) {
                        throw new ArithmeticException("ArithmeticException: Division by zero.");
                    }
                    int result = num1 / num2;
                    System.out.println("Result: " + result);
                } catch (ArithmeticException innerException) {
                    System.out.println("Inner try block caught an ArithmeticException: " + innerException.getMessage());
                }
            }
        } catch (Exception outerException) {
            System.out.println("Outer try block caught a CustomException: " + outerException.getMessage());
        }
    }
}



